Skip to content

Add royalty mechanism#306

Draft
QuanMPhm wants to merge 1 commit into
CCI-MOC:mainfrom
QuanMPhm:303/royalty
Draft

Add royalty mechanism#306
QuanMPhm wants to merge 1 commit into
CCI-MOC:mainfrom
QuanMPhm:303/royalty

Conversation

@QuanMPhm

Copy link
Copy Markdown
Contributor

Closes #303. I'll set this as draft, as I have some questions.

This involved several changes:

  • New field moc_member in institution list
  • New pipeline setting royalty_rate, default to fetching from nerc_rates
  • Coldfront processor will now obtain info on whether a project is externally funded from Coldfront API
  • New processor and invoice to calculate and export the royalties

IS_EXTERNALLY_FUNDED_COLUMN = InvoiceColumn(
name=IS_EXTERNALLY_FUNDED_FIELD, dtype=BOOL_FIELD_TYPE, default_value=False
) # TODO: We are fine with this default?
ROYALTY_COLUMN = InvoiceColumn(name=ROYALTY_FIELD, dtype=BALANCE_FIELD_TYPE)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joachimweyl @naved001 @knikolla Are we fine with False as the default for this field. This will mean, if a Coldfront project does not specify the Is Externally Funded attribute, invoicing will assume it is internally funded.

Comment on lines +9 to +18
export_columns_list = [ # TODO: Confirm list of information we want to include in royalty report
invoice.INVOICE_DATE_FIELD,
invoice.PROJECT_FIELD,
invoice.PI_FIELD,
invoice.CLUSTER_NAME_FIELD,
invoice.INSTITUTION_FIELD,
invoice.SU_TYPE_FIELD,
invoice.BALANCE_FIELD,
invoice.ROYALTY_FIELD,
]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joachimweyl @knikolla @naved001 Are we fine with these sets of columns for now for the royalty invoice? Are there any other info we want to provide to RH?

@dataclass
class PrepaymentProcessor(discount_processor.DiscountProcessor):
IS_DISCOUNT_BY_NERC = True
IS_DISCOUNT_BY_NERC = False

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was to address the fact that prepayments are still subject to the royalty. With this change, the prepay discount will no longer impact the Balance column, which we've used to indicate the money we (the MOC) expect to obtain, which is our revenue, which is the actually value subject to the royalty, as opposed to the money PIs are expected to pay (PI Balance), which are not subject to the royalty.

This change will impact how the PI-specific invoices are exported, and as mentioned by @knikolla in slack, we may want to review how we handle these balance columns and refactor them.

@knikolla @naved001 Given that we have no prepayments yet, are we fine with postponing refactoring the balance fields after this PR is merged?

@QuanMPhm QuanMPhm marked this pull request as draft June 16, 2026 13:31
This involved several changes:
- New field `moc_member` in institution list
- New pipeline setting `royalty_rate`, default to fetching from nerc_rates
- Coldfront processor will now obtain info on whether a project is externally funded from Coldfront API
- New processor and invoice to calculate and export the royalties
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement processor and invoice to show percentage royalties for externally funded projects

1 participant